package icraf.carbon.gui.chart;

import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;

import javax.swing.Icon;

public class  ColorIcon implements Icon {
		public Color color = Color.red;
		public int height = 10;
		public int width = 10;

		public ColorIcon(Color color) {
			super();
			this.color = color;
		}
		
		

		public ColorIcon(Color color, int width, int height) {
			super();
			this.color = color;
			this.height = height;
			this.width = width;
		}



		@Override
		public int getIconHeight() {
			return height;
		}

		@Override
		public int getIconWidth() {
			return width;
		}

		@Override
		public void paintIcon(Component c, Graphics g, int x, int y) {
			Graphics2D g2 = (Graphics2D) g;
			g2.setColor(color);
//			g2.fill3DRect(x, y, width, height, true);
			g2.fillRect(x, y, width, height);
		}



		public Color getColor() {
			return color;
		}



		public void setColor(Color color) {
			this.color = color;
		}
		
		

	}
